﻿import com.dmotiko.mirador.*
import com.dmotiko.general.*
import com.dmotiko.util.*
import mx.utils.Delegate;
import mx.video.*;

class MiradorRoomGaleria
extends BaseClip {
		
	private var btnNuestrosSalones:Button;
	private var btnVideo:Button;
	private var btnCapacidad:Button;
	private var mcHeader:MovieClip;
	
	private var mcPhotoClip:PhotoClip;
	private var mcPhotoThumbs:MiradorPhotoGalleryThumbs;
		
	private function initClip():Void {
		super.initClip();
			
		var root:MiradorRoomGaleria = this;
		btnVideo.onRelease = function() {
			root.dispatchEvent( { target: root, type: BaseClipEvent.CHANGED, section: MiradorNuestrosSalones.VIDEO_FRAME } )
		}
		btnCapacidad.onRelease = function() {
			root.dispatchEvent( { target: root, type: BaseClipEvent.CHANGED, section: MiradorNuestrosSalones.CAPACIDAD_FRAME } )
		}
		btnNuestrosSalones.onRelease = function() {
			root.dispatchEvent( { target: root, type: BaseClipEvent.CHANGED, section: MiradorNuestrosSalones.HOME_FRAME } )
		}
		
	}
	
	public function childLoaded( evnt ):Void {
		if( MiradorPhotoGalleryThumbs( evnt.target) ){
			//DataTypeUtil.traceObject( data.main, "data.main", true);
			
			mcPhotoThumbs.setData( data.main.photo );
			mcPhotoThumbs.addEventListener( BaseClipEvent.CHANGED, Delegate.create(this, setPhoto) );
		} 
	}
	
	private function setPhoto(e):Void {
		mcPhotoClip.setData(e.data.src);
	}
	
	private function refreshData():Void {
		switch( data.name ) {
			case "danbro":
			mcHeader.gotoAndStop(1);
			break;
			
			case "mirador":
			mcHeader.gotoAndStop(2);
			break;
			
			case "altos":
			mcHeader.gotoAndStop(3);
			break;
		}
	}
		
}